WPF and Silverlight Edition Basic Library > Drop Down > DropDown Features > DropDown Interaction |
Users can interact with items in the drop-down box, or with the C1DropDown control itself at run time. By default users can interact with controls placed within the drop-down box. For example, if you place a button or drop-down box within the C1DropDown control, it will be clickable by users at run time.
To add a Button control to the drop-down box add <Button Height="23" Name="button1" Width="75">Hello World!</Button> within the <c1:C1DropDown> tag so that it appears similar to the following:
XAML |
Copy Code
|
---|---|
<c1:C1DropDown Height="30" Name="c1DropDown1" Width="100"> <Button Height="23" Name="button1" Width="75">Hello World!</Button> </c1:C1DropDown> |
To add a Button control to the drop-down box, add code to the page's constructor so it appears like the following:
Visual Basic |
Copy Code
|
---|---|
Public Sub New() InitializeComponent() Dim C1Button1 as New Button C1Button1.Content = "Hello World!" C1DropDown1.Content = c1button1 End Sub |
C# |
Copy Code
|
---|---|
public Window1() //or public MainPage() in Silverlight { InitializeComponent(); Button c1button1 = new Button(); c1button1.Content = "Hello World!"; c1DropDown1.Content = c1button1; } |
To add multiple items to the C1DropDown control, add a Grid or other panel to the C1DropDown control, and add items to that panel. |